package com.elvin.zoe.parser.call;

import java.util.ArrayList;
import java.util.List;

import com.elvin.zoe.parser.AbstractParser;
import com.elvin.zoe.pojo.CallMessage;
import com.elvin.zoe.pojo.Message;

public abstract class CallLogParser extends AbstractParser {


    @Override
    protected List<Message> parseMessagesFromTokens(List<String> messageTokens) throws Exception {
        List<Message> messages = new ArrayList<Message>();
        for (String messageToken : messageTokens) {
            int type = getMessageType(messageToken);
            String datetime = getMessageDatetime(messageToken);
            int callDuration = getMessageCallDuration(messageToken);
            String datetimeFormat = getMessageDatetimeFormat();
            messages.add(new CallMessage(type, datetime, datetimeFormat, callDuration));
        }
        return messages;
    }

	protected abstract int getMessageCallDuration(String messageToken) ;


}
